try {
    $response = Invoke-WebRequest -Uri 'http://localhost:5269/api/file' -UseBasicParsing -ErrorAction Stop
    Write-Host "状态码: $($response.StatusCode)"
    Write-Host "响应内容: $($response.Content)"
} catch {
    Write-Host "错误类型: $($_.Exception.GetType().FullName)"
    Write-Host "错误信息: $($_.Exception.Message)"
    if ($_.Exception.Response) {
        $stream = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream())
        $content = $stream.ReadToEnd()
        Write-Host "响应内容: $content"
    }
}